import {Rotation} from '@/api'
//准备actions对象——响应组件中用户的动作
const actions = {
    async getRotation(state, obj) {
        let info = await Rotation(obj)
        if (info['code'] === 200) {
            state.commit('setRotation', {
                menu_time: info['menu_time'],
                menu_imt: info['menu_imt']
            })
        }
    }
}
//准备mutations对象——修改state中的数据
const mutations = {
    setRotation(state, obj) {
        state.rotation = obj
    }
}
//准备state对象——保存具体的数据
const state = {
    rotation: {
        rotation: [],
        menu_time: 5
    }   // 轮播图信息
}

export default {
    namespaced: true,
    actions,
    mutations,
    state
}